using EasyDapr.Infrastructure.App.Dtos;
using EasyDapr.Infrastructure.Response;
using FluentValidation;
using MediatR;

namespace InventoryService.Application.Requests
{
    /// <summary>
    /// 创建库存请求类
    /// </summary>
    public class CreateInventoryRequest : InventoryDto, IRequest<ApiResult<bool>>
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserId { get; set; }
    }

    public class CreateInventoryValidator : AbstractValidator<CreateInventoryRequest>
    {
        public CreateInventoryValidator()
        {
            RuleFor(p => p.Website)
                .Must(p => !string.IsNullOrEmpty(p))
                .WithMessage("Website is not null or not empty.");
            RuleFor(p => p.Location)
                .Must(p => !string.IsNullOrEmpty(p))
                .WithMessage("Location is not null or not empty.");
        }
    }
}